package com.project.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.project.bean.RecordBean;
import com.project.service.RecordService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.time.LocalDate;

/**
 * 日志
 */
@Controller
@RequestMapping("record")
public class RecordController {

    @Resource
    private RecordService recordService;

    /**
     * 分页显示
     * @param pageNO
     * @param pageSize
     * @return
     */
    @RequestMapping("/findAllRecord")
    @ResponseBody
    public IPage<RecordBean> findAllRecord(@RequestParam(value = "pageNO", defaultValue = "1") int pageNO,
                                           @RequestParam(value = "pageSize", defaultValue = "3") int pageSize) {
        return recordService.findAllRecord(pageNO, pageSize);
    }


    /**
     * 日期显示日志
     * @param pageNO
     * @param pageSize
     * @param startTime
     * @param endTime
     * @return
     */
    @RequestMapping("/findName")
    @ResponseBody
    public IPage<RecordBean> findName(@RequestParam(value = "pageNO", defaultValue = "1") int pageNO,
                                   @RequestParam(value = "pageSize", defaultValue = "3") int pageSize,
                                   LocalDate startTime, LocalDate endTime) {
        return recordService.findName(pageNO, pageSize, startTime, endTime);
    }
}
